﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SocialLearning
{
    public partial class EducationDetailsForm : Form
    {
        #region fields
        List<I_UAC_InstitutionSubjectResult> subjectlist;
        #endregion

        #region constructor
        public EducationDetailsForm()
        {
            InitializeComponent();
            subjectlist = new List<I_UAC_InstitutionSubjectResult>();
            cbxNQFLevel.DataSource = Enum.GetValues(typeof(UAC_Grade));

        }
        #endregion

        #region static creator(Singelton)
        internal static List<I_UAC_InstitutionSubjectResult> Show(UAC_InstitutionBackground institutionBack)
        {
            EducationDetailsForm ed = new EducationDetailsForm();
            ed.txtInstatution.Text = institutionBack.InstitutionName;
            ed.txtstart.Text = institutionBack.StartDate.ToShortDateString();
            ed.txtend.Text = institutionBack.EndDate.ToShortDateString();
            ed.ShowDialog();
            return ed.subjectlist;
        }
        #endregion

        #region Buttons
        private void btnAdd_Click(object sender, EventArgs e)
        {
            UAC_InstitutionSubjectResult subject = new UAC_InstitutionSubjectResult(txtSubjectName.Text, txtCode.Text, (UAC_Grade)cbxNQFLevel.SelectedItem, txtResult.Text);
            subjectlist.Add(subject);
            lblSubAdded.Text = subjectlist.Count().ToString();
            lbxSubjects.Items.Add(subject.SubjectName);
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            Close();
        }
        private void btnCancel_Click(object sender, EventArgs e)
        {
           subjectlist = null;
           Close();
        }
        #endregion

    }
}
